/**
 * 
 */
package nju.bean.meeting.gui;

import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import nju.bean.meeting.UML.SingleProperty;

/**
 * @author gongshw
 *
 */
@SuppressWarnings("serial")
public class SinglePropertyEditor extends JPanel {
	private SingleProperty property;
	private String value;
	private JLabel nameLable;
	private JTextField valueField;
	protected SinglePropertyEditor(SingleProperty singleProperty){
		property = singleProperty;
		value = property.getValue();
		initial();
	}
	
	private void initial(){
		setLayout(new BorderLayout());
		nameLable = new JLabel(property.getName());
		nameLable.setSize(40, nameLable.getHeight());
		add(nameLable,BorderLayout.WEST);
		valueField = new JTextField(value);
		valueField.setSize(240, valueField.getHeight());
		add(valueField,BorderLayout.CENTER);
	}
	
	protected void apply() {
		value = valueField.getText();
		property.setValue(value);
	}
}
